<template>
	<view class="order">
		<!-- <view v-if="hasLogin"> -->
		<!-- 导航 按次服务订单-->
		<!-- <u-navbar :is-back="true" title="订单" :height="navHeight" title-color="#3F3F3F" :title-bold="true"
			:background="background" :border-bottom="false"></u-navbar> -->
		<!-- tap切换 -->
		<view style="position: fixed;z-index: 2;width: 750rpx;">
			<u-tabs :list="list" active-color="#FCA800" inactive-color="#000000" font-size="30" font-weight="500"
				:is-scroll="true" :current="current" :gutter="17" @change="change"></u-tabs>
		</view>
		<!-- end -->
		<view class="lings"></view>
		<!-- 列表数据 -->
		<view style="background-color: #F5F5F5;">
			<mescroll-body top="0" :down="downOption" :up="upOption" :height="comHeight" ref="mescrollRef"
				@init="mescrollInit" @down="downCallback"
				style="-webkit-overflow-scrolling: touch;background-color: #F5F5F5!important;">
				<view class="oderList" v-for="(item, index) in goosList" :key="index">
					<view>
						<view class="shop">
							<view>
								<view v-if="item.orderName" class="shop_name">
									<image :src="item.entPortrait" mode=""></image>
									<view style="margin-left: 12rpx;color: #000000;font-size: 26rpx;">
										{{ item.orderName }}
									</view>
									<!-- 										<image src="../../static/icon/shangjian.png" mode="" style="width: 11rpx;height: 20rpx;margin-left: 28rpx;"></image> -->
								</view>
								<view v-else>
									<view style="color: #000000;font-size: 26rpx;">正在匹配</view>
								</view>
							</view>
							<view
								:class="item.orderStatus == 'CANCEL' || item.orderStatus == 'FINISH_APPRAISE' ? 'shop_statuss' : 'shop_status'">
								{{ item.statusName }}
							</view>
						</view>
						<view class="line"></view>
						<view class="allorder">
							<view class="orders"
								@tap.stop="orderDetai(item.orderId, item.orderStatus, item.chargeType)">
								<image :src="item.orderImg" style="width: 130rpx;height: 130rpx;" mode="aspectFill">
								</image>
								<view class="person">
									<view v-if="item.orderType != 3" class="servertime">
										<text class="order_content"
											style="color: #3F3F3F;font-size: 30rpx;">{{ item.businessName }}</text>
									</view>
									<view v-if="item.orderType != 3" class="ordertime" style="margin-top: 15rpx;">
										<text class="users" style="color: #000000;">下单时间：</text>
										<text class="order_content" style="color: #000000;">{{ item.createTime }}</text>
									</view>
									<view v-if="item.orderType == 3" class="ordertime" style="">
										<text class="users" style="color: #000000;">下单时间：</text>
										<text class="order_content" style="color: #000000;">{{ item.createTime }}</text>
									</view>
									<view class="ordertime" style="margin-top: 15rpx;">
										<text class="users" style="color: #000000;">预约时间：</text>
										<text class="order_content"
											style="color: #000000;">{{ item.startTime ? item.startTime.slice(0, 16) : '' }}</text>
									</view>
									<view v-if="item.orderType == 3" class="ordertime" style="margin-top: 15rpx;">
										<text class="users" style="color: #000000;">数量：</text>
										<text class="order_content" style="color: #000000;">{{ item.amount }}</text>
									</view>
									<!-- <view class="servertime">
										<text class="order_content" style="color: #000000;">{{ item.extTimeStr }}</text>
									</view> -->
									<view
										v-if="item.orderStatus != 'MATCHING' && !(item.orderName == null && item.orderStatus == 'CANCEL')"
										class="price" style="text-align: right;color: #222222;">
										<text class="jine" style="color: #222222;font-size: 26rpx;"
											v-if="item.totalPay">实付：￥</text>
										<text class="money"
											style="font-size: 30rpx;color: #222222;">{{ item.totalPay }}</text>
									</view>
								</view>
							</view>
							<view
								style="width: 92%;flex-wrap: wrap; margin: auto;padding-bottom: 16rpx; display: flex;align-items: center;flex-direction:row-reverse;">
								<view @tap.stop="sqtuikuan(item.orderId, 1)"
									v-if="item.statusName == '进行中' && item.isDistribution == 1" class="btton_one">申请退款
								</view>
								<!-- 支付附加费 -->
								<view @tap.stop="zffjf(item)" v-if="item.statusName == '附加费待支付'" class="btton_two">立即支付
								</view>
								<!--  -->
								<view @tap.stop="ljpj(item.orderId, item.chargeType)" v-if="item.statusName == '待评价'"
									class="btton_one">立即评价</view>
								<!--  -->
								<view @tap.stop="sq_service(item.orderId)" v-if="item.statusName == '待评价'"
									class="btton_one">申请售后</view>
								<view @tap.stop="zlyd(item)" v-if="item.statusName == '已完成' || item.statusName == '已取消'"
									class="btton_two">再来一单</view>
								<view @tap.stop="ljzf(item.orderId)" v-if="item.statusName == '待支付'" class="btton_two">
									立即支付</view>
								<view @tap.stop="shxq(item.orderId)"
									v-if="item.statusName == '售后/退款中' || item.statusName == '退款中'" class="btton_one">
									售后详情</view>
								<view
									@tap.stop="orderDetai(item.orderId, item.orderStatus, item.chargeType)"
									 v-if="item.orderStatus == 'FIGHT_GROUP'"
									style="display: flex;justify-content: space-between;width: 100%;align-items: center;">
									<view>
										<text style="color: #000000;">我的拼团还差</text>
										<text style="color: #FF3D00;">1</text>
										<text style="color: #000000;">人，剩</text>
										<text style="color: #FF3D00;">{{item.groupEndTime}}</text>
									</view>
									<view
										class="btton_two">立即分享</view>
								</view>
								<view @tap.stop="cancleOrder(item)"
									v-if="(item.statusName == '进行中' && item.isDistribution == 0) ||item.statusName == '待支付'"
									class="btton_one">取消订单</view>
							</view>
							<view class="line"></view>
						</view>
					</view>
				</view>
				<view style="padding: 40rpx 0;" v-if="!showList">
					<u-divider color="#DEDEDE" half-width="120" bg-color="#f5f5f5" border-color="#DEDEDE">{{ prompt }}
					</u-divider>
				</view>
				<!-- <view class="nologin" v-if="showList">
					<image src="https://beedao.oss-cn-beijing.aliyuncs.com/aafe2f18d15f4f76aa50d7947184ef62.png" mode="widthFix"></image>
					<view>暂无订单哦</view>
				</view> -->
				<!-- <view @tap="islogin()" class="nologin" v-if="!token">
				<image src="https://beedao.oss-cn-beijing.aliyuncs.com/aafe2f18d15f4f76aa50d7947184ef62.png" mode="widthFix"></image>
				<view>暂未登陆~</view>
			</view> -->
			</mescroll-body>
		</view>
		<u-toast ref="uToast" />
		<!-- 选择支付 -->
		<u-popup mode="bottom" v-model="payorder">
			<view style="width: 100%;position: absolute;top: 0;left: 0;">
				<view style="width: 92%;position: relative;margin:0 auto;">
					<view style="width: 100%;text-align: left;font-size: 30rpx;font-weight: bold;line-height: 80rpx;">
						选择支付方式</view>
					<image @click="payorder=false"
						style="position: absolute;top: 26rpx;right: 24rpx;width: 24rpx;height: 24rpx;position: absolute;"
						src="https://beedao.oss-cn-beijing.aliyuncs.com/94babc7b1aa54980a1abb68a5319c31f.png" mode="">
					</image>
				</view>
			</view>
			<view class="content" style="width: 92%;margin: auto;margin-top: 94rpx;">
				<view style="margin-bottom: 20rpx;">
					<view
						style="display: flex;justify-content: space-between;padding: 20rpx 0;border-bottom: 1rpx solid #D8D8D8;"
						@click="setPayType(1)">
						<view style="display: flex;">
							<view style="display: flex;justify-content: center;align-items: center;">
								<image style="width: 38rpx;height: 36rpx;"
									src="https://beedao.oss-cn-beijing.aliyuncs.com/297779f071654a9689c790b6395d5eaf.png"
									mode=""></image>
							</view>
							<view
								style="color: #757575;margin-left: 10rpx;display: flex;justify-content: center;align-items: center;">
								微信支付</view>
						</view>
						<view style="padding: 8rpx 16rpx;display: flex;justify-content: center;align-items: center;">
							<image style="width: 36rpx;height: 36rpx;" :src="payType == '2' ? payImg.xImg :payImg.noImg"
								mode=""></image>
						</view>
					</view>
					<view
						style="display: flex;justify-content: space-between;padding: 20rpx 0;border-bottom: 1rpx solid #D8D8D8;"
						@click="userInfoVO.money > totalPay?setPayType(2):''">
						<view style="display: flex;">
							<view style="display: flex;justify-content: center;align-items: center;">
								<image style="width: 38rpx;height: 38rpx;"
									src="https://beedao.oss-cn-beijing.aliyuncs.com/3a026cf316644413ad1898dc6841881c.png"
									mode=""></image>
							</view>
							<view
								style="color: #757575;margin-left: 10rpx;display: flex;justify-content: center;align-items: center;">
								余额支付（剩余￥{{userInfoVO.money? userInfoVO.money : 0}}）</view>
						</view>
						<view v-if="userInfoVO.money > totalPay"
							style="padding: 8rpx 16rpx;display: flex;justify-content: center;align-items: center;">
							<image style="width: 36rpx;height: 36rpx;" :src="payType == '1' ? payImg.xImg :payImg.noImg"
								mode=""></image>
						</view>
						<view @click="goMnmber" v-else
							style="padding: 8rpx 16rpx;display: flex;justify-content: center;align-items: center;color: #676767;">
							{{userInfoVO.member ? "立即续费" : "立即开通"}}
						</view>
					</view>
				</view>
				<view
					style="display: flex;justify-content: space-between;align-items: center;padding:12rpx 0rpx 20rpx 0rpx;">
					<view class="writes">
						<text style="color: #757575;font-size:36rpx;">实付款：</text>
						<text style="color: #FFAA00;font-size:34rpx;">￥</text>
						<text
							style="color: #FFAA00;font-size: 40rpx;font-weight: bold;">{{ totalPay ? totalPay : 0 }}</text>
					</view>
					<view @click="clickPay ? promptlyPay(): ''"
						style="width: 48%;height: 88rpx;border-radius: 12rpx;background-color: #FCC800;text-align: center;font-size: 34rpx;color: #323332;line-height: 88rpx;">
						立即支付
					</view>
				</view>
			</view>
		</u-popup>

	</view>
</template>

<script>
	var that;
	export default {
		data() {
			return {
				orderId: "",
				totalPay: 0,
				clickPay: true,
				payImg: {
					xImg: "https://beedao.oss-cn-beijing.aliyuncs.com/3307a934f8774ccc944183d42934e369.png",
					noImg: "https://beedao.oss-cn-beijing.aliyuncs.com/e680513bfd854e33be8f67a06f376a27.png"
				},
				userInfoVO: {}, //用户信息
				payorder: false, //支付弹框
				payType: 1, //支付方式
				showList: false,
				background: {
					backgroundColor: '#ffffff'
				},
				customStyle: {
					backgroundColor: '#FFFFFF',
					color: '#363636',
					border: '2rpx solid #E5E5E5;'
				},
				customType: {
					backgroundColor: '#FFE051',
					color: '#363636'
					// border: '2rpx solid',
					// borderRadius: '30rpx',
					// fontWeight:'bold'
				},
				customFype: {
					backgroundColor: '#FFE051',
					color: '#363636'
				},
				downOption: {
					use: true,
					auto: false,
					offset: 40
				},
				upOption: {
					use: false
				},
				mescroll: null,
				prompt: '',
				tabCur: 'all',
				show: false,
				goods: [], //列表数据
				page: 1,
				pageSize: 15,
				orderstatusid: '',
				nolist: false,

				value: 4,
				list: [{
						name: '全部',
						sign: ''
					},
					{
						name: '拼团中',
						sign: 'fightGroup',
					},
					{
						name: '待支付',
						sign: 'pays',
						tap: 2
					},
					// {
					// 	name: '匹配中',
					// 	sign: 'confirms'
					// },
					// {
					// 	name: '待服务',
					// 	sign: 'needServices',
					// },
					{
						name: '进行中',
						sign: 'onServices'
					},
					// {
					// 	name: '投诉中',
					// 	sign: 'issues',
					// },
					{
						name: '待评价',
						sign: 'waitAppraises'
					},
					{
						name: '已完成',
						sign: 'finishes'
					},
					{
						name: '售后/退款',
						sign: 'issues'
					}
				],
				current: 0,
				goosList: [],
				currents: '',
				group: '',
				pays: '',
				tap: '',
				token: '',
				comHeight: 0,
				navHeight: 0,
				type: '',
				totalPage: 1,
				userId: '',
				isMade: 0,
				nowTime:"",//获取当前时间
				isIos: 1, //是否为ios
			};
		},
		onReachBottom() {
			if (this.totalPage == this.page) {
				return false;
			} else {
				this.page += 1;
				this.appletOrderPage();
			}
		},
		onLoad(option) {
			that = this;
			this.group = option.type;
			var menuButtonInfo = uni.getMenuButtonBoundingClientRect();
			const {
				top,
				width,
				height,
				right
			} = menuButtonInfo;
			uni.getSystemInfo({
				success: res => {
					const {
						statusBarHeight
					} = res;
					const margin = top - statusBarHeight;
					var navHeight = height + statusBarHeight + margin * 4;
					that.navHeight = height + margin * 2;
					that.comHeight = res.windowHeight - navHeight - 50 + 'px';
					if (res.platform == "ios") {
						that.isIos = 1;
					} else {
						that.isIos = 0;
					}
				}
			});
			this.getNowTime();//获取当前时间
			this.current = option.current;
			this.appletOrderPage();
			this.getUserInfo();
		},
		onShow() {
			//判断是否操作过订单，操作了就刷新当前状态
			if (this.isMade == 1) {
				this.isMade = 0;
				this.page = 1;
				this.goosList = [];
				this.appletOrderPage();
			}
		},
		methods: {
			//获取当前时间
			getNowTime(){
				let opts = {
					way: true, //true JSON请求；false 表单请求
					method: 'post',
					url: 'common/time'
				};
				let data = {};
				this.http.httpTokenRequest(opts, data).then(res => {
					if(res.code == '200'){
						this.nowTime=res.data;
					}
				});
			},
			// 去会员页面
			goMnmber() {
				uni.navigateTo({
					url: '../member/meCenter'
				})
			},
			// 用户信息
			getUserInfo() {
				var _this = this;
				let opts = {
					way: true, //true JSON请求；false 表单请求
					method: 'post',
					url: 'user/info'
				};
				let data = {};
				_this.http.httpTokenRequest(opts, data).then(res => {
					if (res.code == "200") {
						_this.userInfoVO = res.data.userInfoVO;
						_this.userInfoVO.money = parseFloat(_this.userInfoVO.money);
					}
				});
			},
			// 选中支付方式
			setPayType(type) {
				this.payType = type;    
			},
			onShareAppMessage(res) {
				var userInfo = JSON.parse(uni.getStorageSync('userinfo'));
				this.userId = userInfo.userId;
				if (res.from === 'button') {
					// 来自页面内分享按钮
				}
				let opts = {
					way: true, //true JSON请求；false 表单请求
					method: 'post',
					url: 'common/insertShareLog'
				};
				let data = {};
				this.http.httpTokenRequest(opts, data).then(res => {
					//分享日志，不需要处理
				});
				
				return {
					title: '必到家政',
					// imageUrl:'https://beedao.oss-cn-beijing.aliyuncs.com/cca1cf07545140e6b44c42f1c9b861d8.png',
					path: '/pages/login/login?id=' + this.userId
					// path: '/pages/home/home?parentId=' + this.userId
				};
			},
			// 进行中和待支付取消订单
			cancleOrder(item) {
				var form = {
					orderName: item.orderName,
					entPortrait: item.entPortrait,
					orderImg: item.orderImg,
					businessName: item.businessName,
					amount: item.amount,
					totalPay: item.totalPay,
					orderId: item.orderId,
					statusName: item.statusName
				};

				uni.navigateTo({
					url: '../../pageageA/order/cancelOrder?form=' + JSON.stringify(form),
				});
			},
			// 立即支付附加费
			promptlyPay() {
				var _this = this;

				uni.showModal({
					title: '提示',
					content: '确定支付吗？',
					cancelText: '取消', // 取消按钮的文字
					confirmText: '确认', // 确认按钮文字
					confirmColor: '#F29423',
					cancelColor: '#979797',
					success: function(res) {
						if (res.confirm) {
							_this.clickPay = false;
							let opts = {
								way: true, //true JSON请求；false 表单请求
								method: 'post',
								url: 'unit-orders/payLess'
							};
							let data = {
								orderId: _this.orderId,
								payType: _this.payType
							};
							_this.http.httpTokenRequest(opts, data).then(res => {
								if (res.code == 200) {
									var needstr = res.data;
									uni.requestSubscribeMessage({
										tmplIds: [
											'IdSIZcF3KlfXRiP4wvU4jwt6hu2tU2LnbsUPfF_Tq80',
											'EjQNBMRd3C1y7Y1OMAyLn7sLsRNoolBBV42v1btLchw'
										],
										success(res) {
											if (needstr.needPay == 0) {
												uni.navigateTo({
													url: '/pageageA/order/paySucess?type=1' +
														'&orderId=' + needstr.orderId
												});
												_this.clickPay = true;
												_this.payorder = false;
											} else {
												_this.wxpay(needstr.vxPayData,needstr.orderId);
											}
										},
										fail(err) {
											if (needstr.needPay == 0) {
												uni.navigateTo({
													url: '/pageageA/order/paySucess?type=1' +
														'&orderId=' + needstr.orderId
												});
												_this.clickPay = true;
												_this.payorder = false;
											} else {
												_this.wxpay(needstr.vxPayData,needstr.orderId);
											}
										}
									});
								} else {
									_this.$refs.uToast.show({
										title: res.message,
										type: 'error'
									});
								}
							});
						}
					}
				});
			},
			// 支付附加费
			zffjf(item) {
				this.orderId = item.orderId;
				this.totalPay = parseFloat(item.totalPay);
				this.payorder = true;
			},
			//申请退款
			sqtuikuan(orderId, chargeType) {
				uni.navigateTo({
					url: '/pageageA/newservice/service_fw?orderId=' + orderId + '&chargeType=' + chargeType
				});
			},
			//申请售后
			sq_service(orderId) {
				uni.navigateTo({
					url: '/pageageA/newservice/service_index?orderId=' + orderId
				});
			},
			//立即评价
			ljpj(orderId, chargeType) {
				if (chargeType == 4) {
					uni.navigateTo({
						url: '/pageageA/order/evaluate?orderId=' + orderId
					});
				} else {
					uni.navigateTo({
						url: '/pageageA/order/evaluate_neworder?orderId=' + orderId
					});
				}
			},
			//再来一单
			zlyd(item) {
				if(item.orderType == 3){
					uni.navigateTo({
						url: '/pageageA/home/shopDetails/tuangouDetails/tuangouDetails?packageBusinessId=' + item.packageBusinessId + '&enterpriseId=' +
							item.enterpriseId
					});
				}else{
					uni.navigateTo({
						url: '/pageageA/placeOrder/selectService?businessId=' + item.businessId + '&enterpriseId=' +
							item.enterpriseId
					});
				}
				
			},
			//售后详情
			shxq(orderId) {
				uni.navigateTo({
					url: '../../pageageA/newservice/service_end?orderId=' + orderId
				});
				// uni.navigateTo({
				// 	url: '../../pageageA/order/service?orderId=' + orderId
				// });
			},
			//立即支付
			ljzf(id) {
				var _this = this;
				uni.showModal({
					title: '提示',
					content: '确定支付吗？',
					cancelText: '取消', // 取消按钮的文字
					confirmText: '确认', // 确认按钮文字
					confirmColor: '#F29423',
					cancelColor: '#979797',
					success: function(res) {
						if (res.confirm) {
							let opts = {
								way: true, //true JSON请求；false 表单请求
								method: 'post',
								url: 'unit-orders/rePayUnit'
							};
							let data = {
								orderId: id
							};
							_this.http.httpTokenRequest(opts, data).then(res => {
								if (res.code == 200) {
									var needstr = res.data;
									uni.requestSubscribeMessage({
										tmplIds: [
											'IdSIZcF3KlfXRiP4wvU4jwt6hu2tU2LnbsUPfF_Tq80',
											'EjQNBMRd3C1y7Y1OMAyLn7sLsRNoolBBV42v1btLchw'
										],
										success(res) {
											if (needstr.needPay == 0) {
												uni.navigateTo({
													url: './paySucess?type=1' +
														'&orderId=' + needstr.orderId
												});
											} else {
												_this.wxpay(needstr.vxPayData, needstr
													.orderId);
											}
										},
										fail(err) {
											if (needstr.needPay == 0) {
												uni.navigateTo({
													url: './paySucess?type=1' +
														'&orderId=' + needstr.orderId
												});
											} else {
												_this.wxpay(needstr.vxPayData, needstr
													.orderId);
											}
										}
									});

									// setTimeout(function() {
									// 	uni.navigateTo({
									// 		url: './orderSuccess?orderId=' + res.data
									// 	});
									// }, 500);
								} else {
									_this.$refs.uToast.show({
										title: res.message,
										type: 'error'
									});
								}
							});
						}
					}
				});
			},
			 addZero(num) {
			    if (parseInt(num) < 10) {
			      num = '0' + num;
			    }
			    return num;
			  },
			//新订单列表
			appletOrderPage() {
				var _this = this;
				_this.prompt = '加载中....';
				let opts = {
					way: true, //true JSON请求；false 表单请求
					method: 'post',
					url: 'unit-orders/appletOrderPage'
				};
				let data = {
					group: _this.group,
					page: _this.page,
					pageSize: _this.pageSize
				};
				_this.http.httpTokenRequest(opts, data).then(res => {
					uni.hideLoading();
					if (res.code == '200') {
						this.totalPage = res.data.pages;
						if (res.data.records.length > 0 || _this.page != 1) {
							var array = res.data.records;
							array.forEach((item, index) => {
								if (item.orderStatus == "FIGHT_GROUP") {
									// let timestamp = Date.parse(new Date());
									// let times=Date.parse(new Date(item.groupEndTime));
									if (_this.isIos == "1") {
										var times = Date.parse(new Date(item.groupEndTime.replace(/-/g, "/")));
									} else {
										var times = Date.parse(new Date(item.groupEndTime));
									}
									let disparity = times - _this.nowTime;
									if (disparity > 0) {
										let d = Math.floor(disparity / (1000 * 60 * 60 * 24)); //计算天数
										let h = this.addZero(Math.floor(disparity / (1000 * 60 * 60) %
										24)); //计算小时数
										let m = this.addZero(Math.floor(disparity / (1000 * 60) %
										60)); //计算分钟数
										let s = this.addZero(Math.floor(disparity / 1000 % 60)); //计算秒数
										item.groupEndTime=h+'时'+m+'分';
									}else{
										item.groupEndTime=0+'时'+0+'分';
									}

								}

							})
							_this.showList = false;
							_this.goosList = [..._this.goosList, ...res.data.records];
							if (res.data.records.length < _this.pageSize) {
								_this.prompt = '没有更多了';
							} else {
								_this.prompt = '加载中....';
							}


						} else {
							_this.showList = false;
							_this.goosList = [];
							_this.prompt = '没有更多了';
						}
					} else {
						_this.prompt = '没有更多了';
						_this.$refs.uToast.show({
							title: res.message,
							type: 'error'
						});
					}
				});
			},
			//一键匹配取消订单
			quxiao(orderId) {
				var _this = this;
				uni.showModal({
					title: '',
					content: '确定要取消该订单吗？',
					cancelText: '我再想想', // 取消按钮的文字
					confirmText: '确认', // 确认按钮文字
					cancelColor: '#F29423',
					confirmColor: '#979797',
					success: function(res) {
						if (res.confirm) {
							let opts = {
								way: true, //true JSON请求；false 表单请求
								method: 'post',
								url: 'unit-orders/cancelOrder'
							};
							let data = {
								orderId: orderId,
								platformType: 1,
							};
							_this.http.httpTokenRequest(opts, data).then(res => {
								if (res.code == 200) {
									_this.$refs.uToast.show({
										title: res.message,
										type: 'success'
									});
									_this.page = 1;
									_this.goosList = [];
									_this.prompt = '加载中....';
									_this.appletOrderPage();
								} else {
									_this.$refs.uToast.show({
										title: res.message,
										type: 'error'
									});
								}
							});
						}
					}
				});
			},

			// islogin() {
			// 	uni.navigateTo({
			// 		url: '/pages/login/login'
			// 	});
			// },
			mescrollInit(mescroll) {
				this.mescroll = mescroll;
			},
			// 下拉刷新回调函数
			downCallback() {
				setTimeout(() => {
					this.page = 1;
					this.goosList = [];
					this.prompt = '加载中....';
					// this.group = '';
					this.appletOrderPage();
					this.mescroll.endSuccess();
				}, 1000);
			},
			change(index) {
				this.tap = index;
				this.current = index;
				this.group = this.list[index].sign;
				this.page = 1;
				this.goosList = [];
				this.prompt = '加载中....';
				this.getNowTime();
				this.appletOrderPage();
			},
			showTab() {
				var _this = this;
				_this.show = !_this.show;
			},
			orderDetai(orderId, orderStatus, chargeType) {
				// if (chargeType == 3) {
				// 	uni.navigateTo({
				// 		url: '../../pageageA/order/tuangouDetail?orderId=' + orderId + '&orderStatus=' + orderStatus
				// 	});
				// } else {
				uni.navigateTo({
					url: '../../pageageA/order/orderDetail?orderId=' + orderId + '&orderStatus=' + orderStatus
				});
				// }
			},
			getGoosList() {
				var _this = this;
				let opts = {
					way: true, //true JSON请求；false 表单请求
					method: 'post',
					url: 'orders/my'
				};
				// uni.showLoading({
				// 	title: '加载中',
				// 	mask: true
				// });
				let data = {
					group: _this.group,
					page: _this.page,
					pageSize: _this.pageSize
				};
				_this.http.httpTokenRequest(opts, data).then(res => {
					uni.hideLoading();
					if (res.code == '200') {
						if (res.data.records.length > 0 || _this.page != 1) {
							_this.showList = false;
							if (res.data.current * res.data.size < res.data.total) {
								for (const key in res.data.records) {
									_this.goosList.push(res.data.records[key]);
								}
								_this.prompt = '加载中....';
							} else {
								for (const key in res.data.records) {
									_this.goosList.push(res.data.records[key]);
								}
								_this.prompt = '没有更多了';
							}
						} else {
							_this.showList = true;
							_this.goosList = [];
						}
					} else {
						_this.$refs.uToast.show({
							title: res.message,
							type: 'error'
						});
					}
				});
			},
			//推送
			ts() {
				uni.requestSubscribeMessage({
					tmplIds: ['IdSIZcF3KlfXRiP4wvU4jwt6hu2tU2LnbsUPfF_Tq80',
						'EjQNBMRd3C1y7Y1OMAyLn7sLsRNoolBBV42v1btLchw'
					],
					success(res) {},
					fail(err) {}
				});
			},
			anniu(items, orderId, businessId, chargeType, employeeId, orderStatus, orderType) {
				if (that.is_click == true) {
					that.is_click = false;
					var _this = this;
					var opts = {};
					var data = {};
					switch (items.redirectType) {
						case 1:
							//请求接口
							opts = {
								way: true, //true JSON请求；false 表单请求
								method: 'post',
								url: items.uri
							};
							data = {
								orderId: orderId
							};
							_this.http.httpTokenRequest(opts, data).then(res => {
								that.is_click = true;
								if (res.code == 200) {
									_this.$refs.uToast.show({
										title: res.message,
										type: 'success'
									});
									_this.page = 1;
									_this.goosList = [];
									_this.prompt = '加载中....';
									_this.getGoosList();
								} else {
									_this.$refs.uToast.show({
										title: res.message,
										type: 'error'
									});
								}
							});
							break;
						case 2:
							// 订单详情
							uni.navigateTo({
								url: '../../pageageA/order/orderDetail?orderId=' + orderId + '&orderStatus=' +
									orderStatus
							});
							break;
						case 3:
							// 跳转定金页面
							uni.navigateTo({
								url: '../../pageageA/order/deposit?orderId=' + orderId
							});
							break;
						case 4:
							// 跳转签约页面
							uni.navigateTo({
								url: '../../pageageA/order/sign?orderId=' + orderId + '&redirectType=' + items
									.redirectType
							});
							break;
						case 5:
							// 跳转续约页面
							uni.navigateTo({
								url: '../../pageageA/order/sign?orderId=' + orderId + '&redirectType=' + items
									.redirectType
							});
							break;
						case 6:
							// 立即评价
							uni.navigateTo({
								url: '../../pageageA/order/evaluate?orderId=' + orderId
							});
							break;
						case 7:
							// 再次下单
							uni.navigateTo({
								url: '../../pageageA/service/online_order?businessId=' +
									businessId +
									'&orderId=' +
									orderId +
									'&chargeType=' +
									chargeType +
									'&employeeId=' +
									employeeId +
									'&zcxd=1' +
									'&orderType=' +
									orderType
							});
							break;
						case 8:
							// 跳转简历
							uni.navigateTo({
								url: '../../pageageA/home/matching/hisResume/hisResume?employeeId=' + employeeId +
									'&redirectId=' + businessId + '&addType=2'
							});
							break;
						case 9:
							uni.showModal({
								title: '',
								content: '确定要取消该订单吗？',
								cancelText: '我再想想', // 取消按钮的文字
								confirmText: '确认', // 确认按钮文字
								cancelColor: '#F29423',
								confirmColor: '#979797',
								success: function(res) {
									that.is_click = true;
									if (res.confirm) {
										let opts = {
											way: true, //true JSON请求；false 表单请求
											method: 'post',
											url: items.uri
										};
										let data = {
											orderId: orderId
										};
										_this.http.httpTokenRequest(opts, data).then(res => {
											if (res.code == 200) {
												_this.$refs.uToast.show({
													title: res.message,
													type: 'success'
												});
												_this.page = 1;
												_this.goosList = [];
												_this.prompt = '加载中....';
												_this.getGoosList();
											} else {
												_this.$refs.uToast.show({
													title: res.message,
													type: 'error'
												});
											}
										});
									}
								}
							});
							break;
						case 10:
							// 支付日常订单
							// that.ts();
							opts = {
								way: true, //true JSON请求；false 表单请求
								method: 'post',
								url: items.uri
							};
							data = {
								orderId: orderId
							};
							_this.http.httpTokenRequest(opts, data).then(res => {
								if (res.code == 200) {
									var needstr = res.data;
									uni.requestSubscribeMessage({
										tmplIds: ['IdSIZcF3KlfXRiP4wvU4jwt6hu2tU2LnbsUPfF_Tq80',
											'EjQNBMRd3C1y7Y1OMAyLn7sLsRNoolBBV42v1btLchw'
										],
										success(res) {
											if (needstr.needPay == 0) {
												uni.navigateTo({
													url: '../../pageageA/order/paySucess?type=1' +
														'&orderId=' + orderId
												});
											} else {
												_this.wxpay(needstr.vxPayData,orderId);
											}
										},
										fail(err) {
											if (needstr.needPay == 0) {
												uni.navigateTo({
													url: '../../pageageA/order/paySucess?type=1' +
														'&orderId=' + orderId
												});
											} else {
												_this.wxpay(needstr.vxPayData,orderId);
											}
										}
									});
								} else {
									_this.$refs.uToast.show({
										title: res.message,
										type: 'error'
									});
								}
							});
							break;
						case 11:
							// 支付日常订单
							opts = {
								way: true, //true JSON请求；false 表单请求
								method: 'post',
								url: items.uri
							};
							data = {
								orderId: orderId
							};
							_this.http.httpTokenRequest(opts, data).then(res => {
								if (res.code == 200) {
									var needstr = res.data;
									uni.requestSubscribeMessage({
										tmplIds: ['IdSIZcF3KlfXRiP4wvU4jwt6hu2tU2LnbsUPfF_Tq80',
											'EjQNBMRd3C1y7Y1OMAyLn7sLsRNoolBBV42v1btLchw'
										],
										success(res) {
											if (needstr.needPay == 0) {
												uni.navigateTo({
													url: '../../pageageA/order/paySucess?type=1' +
														'&orderId=' + orderId
												});
											} else {
												_this.wxpay(needstr.vxPayData,orderId);
											}
										},
										fail(err) {
											if (needstr.needPay == 0) {
												uni.navigateTo({
													url: '../../pageageA/order/paySucess?type=1' +
														'&orderId=' + orderId
												});
											} else {
												_this.wxpay(needstr.vxPayData,orderId);
											}
										}
									});
								} else {
									_this.$refs.uToast.show({
										title: res.message,
										type: 'error'
									});
								}
							});
							break;
						case 12:
							// 申请售后
							uni.navigateTo({
								url: '../../pageageA/order/cause?orderId=' + orderId + '&chargeType=' + chargeType+'&type='+2
							});
							break;
						case 13:
							// 售后进度
							uni.navigateTo({
								url: '../../pageageA/order/service?orderId=' + orderId
							});
							break;
						case 14:
							// 支付团购订单
							opts = {
								way: true, //true JSON请求；false 表单请求
								method: 'post',
								url: 'orders/rePay/package'
							};
							data = {
								orderId: orderId
							};
							_this.http.httpTokenRequest(opts, data).then(res => {
								if (res.code == 200) {
									var needstr = res.data;
									uni.requestSubscribeMessage({
										tmplIds: ['IdSIZcF3KlfXRiP4wvU4jwt6hu2tU2LnbsUPfF_Tq80',
											'EjQNBMRd3C1y7Y1OMAyLn7sLsRNoolBBV42v1btLchw'
										],
										success(res) {
											if (needstr.needPay == 0) {
												uni.navigateTo({
													url: '../../pageageA/order/paySucess?type=1' +
														'&orderId=' + orderId
												});
											} else {
												_this.wxpayes(needstr.vxPayData, orderId);
											}
										},
										fail(err) {
											if (needstr.needPay == 0) {
												uni.navigateTo({
													url: '../../pageageA/order/paySucess?type=1' +
														'&orderId=' + orderId
												});
											} else {
												_this.wxpayes(needstr.vxPayData, orderId);
											}
										}
									});
								} else {
									that.is_click = true;
									_this.$refs.uToast.show({
										title: res.message,
										type: 'error'
									});
								}
							});
							break;
						default:
							break;
					}
				} else {
					// uni.showToast({
					// 	title: '请不要频繁操作',
					// 	icon: 'none'
					// })
				}
			},
			wxpay(str, orderId) {
				let _this = this;
				let query = str;
				uni.requestPayment({
					provider: 'wxpay',
					appId: query.appId,
					timeStamp: query.timeStamp + '',
					nonceStr: query.nonceStr,
					package: query.package,
					signType: query.signType,
					paySign: query.sign,
					success: res => {
						uni.navigateTo({
							url: '/pageageA/order/paySucess?type=1' + '&orderId=' + orderId
						});
						_this.clickPay = true;
						_this.payorder = false;
					},
					fail: val => {
						_this.clickPay = true;
						_this.payorder = false;
						uni.showToast({
							title: '支付失败',
							icon: 'none'
						});
					}
				});
			},
			wxpayes(str, orderId) {
				let query = str;
				uni.requestPayment({
					provider: 'wxpay',
					appId: query.appId,
					timeStamp: query.timeStamp + '',
					nonceStr: query.nonceStr,
					package: query.package,
					signType: query.signType,
					paySign: query.sign,
					success: res => {
						uni.navigateTo({
							url: '../../pageageA/order/paySucess?type=1' + '&orderId=' + orderId +
								'&taocan=1'
						});
					},
					fail: val => {
						uni.showToast({
							title: '支付失败',
							icon: 'none'
						});
					}
				});
			}
		}
	};
</script>

<style scoped lang="scss">
	page {
		background-color: #f5f5f5 !important;
	}

	/* 导航 */
	.order {
		// height: calc(100vh - var(--status-bar-height) - 44px);
		height: 100vh;
		background-color: #f5f5f5;
	}

	.btton_one {
		width: 154rpx;
		height: 64rpx;
		margin-left: 24rpx;
		text-align: center;
		line-height: 64rpx;
		border: 1px solid #e5e5e5;
		border-radius: 20rpx;
		color: #363636;
		font-size: 26rpx;
	}

	.btton_two {
		width: 204rpx;
		height: 64rpx;
		margin-left: 24rpx;
		line-height: 64rpx;
		text-align: center;
		color: #363636;
		font-size: 26rpx;
		background: #ffe051;
		border-radius: 20rpx;
	}

	/* 未登录状态 */
	.nologin {
		width: 100%;
	}

	.nologin image {
		width: 500rpx;
		display: block;
		margin: 0 auto;
		margin-top: 178rpx;
	}

	.nologin view {
		font-size: 28rpx;
		color: #333;
		text-align: center;
		margin-top: 25rpx;
	}

	.nologin navigator {
		width: 412rpx;
		height: 90rpx;
		// background-color: $uni-color1;
		line-height: 90rpx;
		color: #fff;
		font-size: 36rpx;
		text-align: center;
		border-radius: 45rpx;
		margin: 0 auto;
		margin-top: 100rpx;
	}

	.oderList {
		// width: 348px;
		// height: 198px;
		background: #ffffff;
		margin: 10rpx 0;
		border-radius: 16rpx;
	}

	.shop {
		display: flex;
		justify-content: space-between;
		align-items: center;
		// padding: 16rpx 22rpx 12rpx 46rpx;
		height: 64rpx;
		width: 92%;
		margin: 0 auto;
	}

	.shop_name {
		display: flex;
		align-items: center;
	}

	.shop_name image {
		width: 38rpx;
		height: 36rpx;
	}

	.shop_status {
		font-size: 26rpx;
		font-family: PingFang SC;
		font-weight: 500;
		color: #f29423;
		opacity: 0.91;
	}

	.shop_statuss {
		font-size: 26rpx;
		font-family: PingFang SC;
		font-weight: 500;
		color: #b0b5b8;
		opacity: 0.91;
	}

	.line {
		border: 2rpx solid #f0f0f0;
		opacity: 0.91;
		// margin-top: 22rpx;
	}

	.allorder {
		// padding-top: 12rpx;
	}

	.orders {
		display: flex;
		width: 92%;
		margin: 0 auto;
		padding: 20rpx 0;
	}

	.orders image {
		width: 152rpx;
		height: 152rpx;
	}

	.person {
		margin-left: 17rpx;
		width: 75%;
	}

	.order_user {
		display: flex;
		align-items: center;
		// padding-top: 6rpx;
		font-size: 36rpx;
		color: #3f3f3f;
	}

	.users {
		font-size: 26rpx;
	}

	.order_content {
		font-weight: 500;
		font-size: 26rpx;
		color: #000000;
	}

	.rate {
		font-family: PingFang SC;
		color: #f29423;
		// padding: 4rpx 0 6rpx 0;
		font-size: 30rpx;
	}

	.ordertime {
		padding: 0rpx 0 8rpx 0;
		font-size: 26rpx;
	}

	.servertime {
		font-size: 26rpx;
		padding: 0rpx 0 8rpx 0;
	}

	.ordermoney {
		display: flex;
		justify-content: space-between;
		margin: 0 22rpx 14rpx 0;
	}

	.price {
		font-size: 30rpx;
		margin-top: 26rpx;
	}

	.jine {
		color: #979797;
	}

	.money {
		color: #f29423;

		font-weight: 800;
	}

	.lings {
		height: 50px;
	}
</style>
